package com.macro.mall.config;

import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.dto.IndexDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("mall-es")
public interface EsConfig {
    /**
     * 创建 索引
     */
    @PostMapping("/foundIndex")
    public void foundIndex(@Validated @RequestBody IndexDto indexDto);

    /**
     * 删除索引
     */
    @DeleteMapping("/delIdnex")
    public void delIdnex(@Validated @RequestBody IndexDto indexDto);

    /**
     * 上架
     */
    @GetMapping("/putaway/{ids}")
    public void putaway(@PathVariable List<Long> ids);

    /**
     * 查询 索引
     */
    @PostMapping("/selIndex")
    public void selIndex(@Validated @RequestBody IndexDto indexDto);


    /**
     * 判断索引 是否存在
     */
    @PostMapping("/exists")
    public CommonResult exists(@Validated @RequestBody String indexName);
    /**
     * 下架
     */
    @GetMapping("/soldOut/{ids}")
    public void soldOut(@PathVariable  List<Long> ids);
}
